package com.youdianda.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.youdianda.dto.YddUserDTO;
import com.youdianda.dto.YddUserPageQueryDTO;
import com.youdianda.entity.YddUser;
import com.youdianda.vo.BaseInfoNewUserVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface YddUserTrueMapper extends BaseMapper<YddUser> {

    /**根据条件查找user数量*/
    Integer getUserCountByNameAndMobileAndUsername(String username,String mobile,Integer sex);

    /**根据条件分页查询User集合*/
    List<YddUser> getUserPageByNameAndMobileAndUsername(String username,String mobile,Integer sex,Integer start,Integer pageSize);

    /**根据id查user*/
    YddUser getYddUserById(Integer id);

    /**会员修改*/
    void updateYddUser(YddUserDTO dto);

    /**会员添加*/
    void addYddUser(YddUser yddUser);

    /**会员删除*/
    void deleteYssUserById(Integer id);

    //以下是baseinfo相关

    @Select("select * from ydd_user where username = #{loginName}")
    YddUser getbyname (String loginName);

    @Select("select id,sex,username,icon,address from ydd_user order by id desc limit 7")
    List<BaseInfoNewUserVO> getBaseInfoNewUserVOCount();

    @Select("select count(*) from ydd_user")
    Integer getTotalUserCount();

    @Select("select count(*) from ydd_user where sex=0")
    Integer getManUserCount();

    @Select("select count(*) from ydd_user where sex=1")
    Integer getWomanUserCount();
}
